package com.kehutong.crm.message.admin;

import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;
import org.coraframework.mvc.http.result.Result;
import com.kehutong.crm.message.entity.MessageTemplateSms;
import com.kehutong.crm.message.service.MessageSmsService;

/**
 * 管理后台-消息管理-站内信模板管理
 */
@MvcAction
@ReqMapping("/admin/crm/message/sms")
public class MessageSmsController {

    @Inject
    private MessageSmsService smsService;

    @HasPermission("crm:message:sms:view")
    @ReqMapping("/list/page")
    public Object listPage(JSONObject jsonObject) {
        return smsService.listPage(jsonObject);
    }

    @HasPermission("crm:message:sms:add")
    @Bean(newInstance=true, copy=true)
    @ReqMapping("/save")
    public Object save(MessageTemplateSms sms) {
        return smsService.save(sms);
    }

    @HasPermission("crm:message:sms:edit")
    @Bean(copy=true)
    @ReqMapping("/update")
    public Object update(MessageTemplateSms sms) {
        return smsService.update(sms);
    }

    @HasPermission("crm:message:sms:del")
    @ReqMapping("/delete")
    public Object delete(MessageTemplateSms sms) {
        return smsService.delete(sms);
    }

    @ReqMapping("/refresh/status")
    public Object refreshStatus(){
        return smsService.refreshStatus();
    }

    @ReqMapping("/get")
    public Object get(MessageTemplateSms sms) {
        return Result.success(sms);
    }
}
